PRIVATE FUNCTION axcp006_get_imaa001_exp()
DEFINE r_success      LIKE type_t.num5
DEFINE l_success      LIKE type_t.num5
DEFINE l_flag1        LIKE type_t.chr1
DEFINE l_flag2        LIKE type_t.chr1
DEFINE l_sql          STRING

   WHENEVER ERROR CONTINUE
   LET r_success = TRUE
   
   DELETE FROM axcp006_xcah
   
   # ??SQL????
   LET l_sql = cl_parse_sql_file("src/4fd/axcp006_bom_recursive.sql")
   
   IF NOT cl_null(g_wc_imaa001) THEN
      LET l_sql = l_sql CLIPPED," AND ",g_wc_imaa001
   END IF

   PREPARE axcp006_get_imaa001_exp_p FROM l_sql
   EXECUTE axcp006_get_imaa001_exp_p USING g_enterprise, g_master.xcad001
   
   IF SQLCA.sqlcode THEN
      INITIALIZE g_errparam TO NULL
      LET g_errparam.code = SQLCA.sqlcode
      LET g_errparam.extend = "ins xcah"
      LET g_errparam.popup = TRUE
      CALL cl_err()
      LET r_success = FALSE
      RETURN r_success
   END IF
   
   IF SQLCA.sqlerrd[3] = 0 THEN
      LET l_flag1 = 'N'
   END IF
   
   # ??xcab_t???
   IF l_flag1 = 'N' AND l_flag2 = 'N' THEN 
      INITIALIZE g_errparam TO NULL
      LET g_errparam.code = 'axc-00530'
      LET g_errparam.extend = ""
      LET g_errparam.popup = TRUE
      CALL cl_err()
      LET r_success = FALSE
      RETURN r_success   
   END IF
   
   RETURN r_success 
END FUNCTION

   CREATE TEMP TABLE axcp006_xcah
         (
              xcah004    LIKE xcah_t.xcah004,   #?????? ** ##
              xcah012    LIKE xcah_t.xcah012,   #???????
              xcah013    LIKE xcah_t.xcah013,   #?????? 
              xcahseq    LIKE xcah_t.xcahseq,   #??        ** @@
              xcah022    LIKE xcah_t.xcah022,   #????    **  ##
              xcah023    LIKE xcah_t.xcah023,   #?????
              xcah024    LIKE xcah_t.xcah024,   #????
              xcah020    LIKE xcah_t.xcah020,   #??        **
              xcah021    LIKE xcah_t.xcah021,   #BOM?????????BOM??+10 **
              xcah042    LIKE xcah_t.xcah042,   #??????????
              xcah043    LIKE xcah_t.xcah043,   #????????????
              xcah044    LIKE xcah_t.xcah044,   #???????????
              num_m      LIKE xcad_t.xcad007,   #?????????????????xcah????
              xcah040    LIKE xcah_t.xcah040,   #??????    ** ##
              xcah041    LIKE xcah_t.xcah041,   #???????  
              xcah028	 LIKE xcah_t.xcah028,   #?????????????  ** @@
              xcah025    LIKE xcah_t.xcah025,   #??????????     --???????BOM????
              xcah026    LIKE xcah_t.xcah026,   #???????????? --???????BOM??
              xcah027    LIKE xcah_t.xcah027,   #???????????   --???????BOM??
              num_s      LIKE xcad_t.xcad007,    #?????????????????xcah????
              #171211-00028#10--add---s
              xcah005    LIKE xcah_t.xcah005,
              xcah045    LIKE xcah_t.xcah045,
              xcah046    LIKE xcah_t.xcah046,
              #171211-00028#10--add---e
              #211210-00029#2 add---(s)
              xcah047    LIKE xcah_t.xcah047,
              xcah048    LIKE xcah_t.xcah048,
              xcah049    LIKE xcah_t.xcah049
              #211210-00029#2 add---(e)
          );
